import time
import unittest
from page.home_page_lcy import Home_Page


class DownloadTestcase(unittest.TestCase):
    @classmethod
    def setUpClass(cls) -> None:
        cls.home = Home_Page(appPackage='com.nearme.gamecenter', appActivity='.ui.activity.SplashActivity')

    def test_01_download(self):
        self.home.rank_click()
        time.sleep(3)
        text1 = self.home.get_app_name()
        self.home.install_click()
        self.home.download_click()
        time.sleep(3)
        text2 = self.home.get_download_app_name()
        time.sleep(5)
        self.assertEqual(text1, text2, msg="断言下载的应用和下载管理中的应用一致")

    @classmethod
    def tearDownClass(cls) -> None:
        cls.home.quit()


if __name__ == '__main__':
    unittest.main(verbosity=2)
